package com.thoughtworks.videorental.domain;

public class NewReleasePrice implements Price {

	private int discountPeriod = 7;
	private int freeDays = 1;
	
	public int getFreeDays() {
		return freeDays;
	}

	public void setFreePeriod(int freePeriod) {
		this.freeDays = freeDays;
	}
	
	public int getDiscountPeriod() {
		return discountPeriod;
	}

	public void setDiscountPeriod(int discountPeriod) {
		this.discountPeriod = discountPeriod;
	}
	
	public double getCharge(final int daysRented) {
		//return getEffectiveRentedDays(daysRented) * 3;
		return 3;
		
	}
	
	private int getEffectiveRentedDays(int daysRented) {
		if (daysRented % discountPeriod == 0){
			freeDays = daysRented/discountPeriod;
			return (daysRented - freeDays ) ;
		}
		else
			return daysRented;	
	}

	public int getFrequentRenterPoints(final int daysRented) {
		// add bonus for a two day new release rental
		if (daysRented > 1)
			return 2;
		else
			return 1;
	}

    @Override
    public String getDisplayName() {
        return "New Release";
    }

	

}
